<?php

namespace Tests;


use GuzzleHttp\Client;
use XWX\Common\ElasticSearch\ElasticSearch;
use XWX\Common\WebClient\WebClient;
use XWX\Common\XArray\XArray;

class test_es extends TestBase
{
    protected function getEs()
    {
        $host = 'http://192.168.0.88:9200/';

        $app = ElasticSearch::funcIns($host);

        $client = new Client(['tiemout' => 3]);
        $app->setWebClient($client);

        return $app;
    }

    function test_index()
    {
        $app = $this->getEs();

//        $r = $app->index()->get('test');
//        $this->funcLog($r);
//        $this->assertEquals($r->ok(), true);


        $r = $app->index()->delete('test');
        $this->funcLog($r);
        $this->assertEquals($r->ok(), true);
    }

}